package com.open.capacity.common.config;

import com.open.capacity.interceptor.LicenseCheckInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web相关配置
 *
 * @date 2018/7/9
 * @since 1.0.0
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Bean
    public LicenseCheckInterceptor getLicenseInterceptor(){
        return  new LicenseCheckInterceptor();
    }

    /**
     * 添加拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) { ///oauth/token
        registry.addInterceptor(getLicenseInterceptor()).addPathPatterns("/login.html");
    }
}
